﻿
Imports webctrl

Public Class traceIdVar
    Public Const varName As String = "trcid"

    Private Shared Function value() As String
        Return """" + httpServer3.currentContext().traceID() + """"
    End Function

    Public Shared Sub invoke(ByVal inlineScript As inlineScript)
        var.invoke(inlineScript, varName, value())
    End Sub

    Public Shared Function invoke(Optional ByRef actionTarget As String = Nothing) As String
        Return var.invoke(varName, value(), actionTarget)
    End Function

    Public Shared Function name(Optional ByVal inlineScript As inlineScript = Nothing) As String
        If Not inlineScript Is Nothing Then
            invoke(inlineScript)
        End If

        Return varName
    End Function
End Class
